Skip to content

Deploy Workflow - #43

Merged
iSiRaH merged 11 commits into
mainfrom
Hosting
Mar 14, 2026
Merged

Deploy Workflow#43
iSiRaH merged 11 commits into
mainfrom
Hosting

Conversation

@JinethBosilu

Copy link
Copy Markdown
Collaborator

No description provided.

Copilot AI review requested due to automatic review settings March 14, 2026 12:30

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds deployment infrastructure (Dockerfile, GitHub Actions CI/CD workflow, ECS task definition) for the CrimeLink Analyzer backend, along with new weapon request management features and several configuration changes for production readiness.

Changes:

  • Adds Docker multi-stage build, GitHub Actions deploy workflow (ECR → ECS Fargate), and ECS task definition template
  • Introduces a new WeaponRequest feature (entity, DTO, mapper, repository, service, controller) and new weapon issue/history endpoints
  • Updates configuration: removes localhost defaults for Python microservice URLs, centralizes CORS config, adds HikariCP prepareThreshold=0 fix, and removes hardcoded @CrossOrigin annotations

Reviewed changes

Copilot reviewed 26 out of 27 changed files in this pull request and generated 9 comments.

Show a summary per file
File Description
.github/workflows/deploy.yml New CI/CD pipeline: build Docker image, push to ECR, deploy to ECS Fargate
Dockerfile Multi-stage Docker build (Maven → JRE 21 Alpine) with non-root user
aws/ecs-task-def.json ECS Fargate task definition template with secrets from SSM
.dockerignore Docker build context exclusions
.env.example Updated with all required env vars and example values
application.properties Removes localhost defaults for Python URLs, adds CORS and HikariCP config
SecurityConfig.java Configurable CORS origins from env var; changes /api/weapon/** to permitAll()
WeaponRequest.java New JPA entity for weapon requests
WeaponRequestStatus.java New enum (PENDING, APPROVED, REJECTED)
WeaponRequestDto.java New DTO for weapon requests
WeaponRequestMapper.java Mapper between entity and DTO
WeaponRequestRepository.java New JPA repository for weapon requests
WeaponRequestService.java New service interface
WeaponRequestServiceImpl.java Service implementation with CRUD + approve/reject
WeaponRequestController.java New REST controller for weapon requests
WeaponRepository.java New JPQL query for active weapons by officer
WeaponIssueRepository.java New query methods for officer weapon history
WeaponService.java / WeaponServiceImpl.java New method to get weapons issued to officer
WeaponController.java New endpoint for weapons by officer
WeaponIssueController.java New endpoints for issued/history, directly using repository
VehicleController.java Removed hardcoded @CrossOrigin
UserController.java Added missing @GetMapping annotation
ReqquiredArgsConstructor.java Accidental empty annotation with misspelled name
backend_logs.txt Committed log file with sensitive data

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

WHERE wi.issuedTo.userId = :userId
AND wi.returnedAt IS NULL
""")
List<Weapon> findActiveWeaponsByOfficer(@Param("officerId") Integer officerId);
Comment on lines +3 to +5
public @interface ReqquiredArgsConstructor {

}
// OIC-only routes
.requestMatchers("/api/duty-schedules/**").hasRole("OIC")
.requestMatchers("/api/weapon/**").hasRole("OIC")
.requestMatchers("/api/weapon/**").permitAll()
Comment on lines +89 to +97
@GetMapping("/issued/{officerId}")
public List<WeaponIssue> getActiveWeapons(@PathVariable Integer officerId) {
return weaponIssueRepository.findByIssuedTo_UserIdAndReturnedAtIsNullOrderByIssuedAtDesc(officerId);
}

@GetMapping("/history/{officerId}")
public List<WeaponIssue> getWeaponIssueHistory(@PathVariable Integer officerId) {
return weaponIssueRepository.findByIssuedTo_UserIdOrderByIssuedAtDesc(officerId);
}
Comment on lines +9 to +15

@Repository
public interface WeaponRequestRepository extends JpaRepository<WeaponRequest, Integer> {

List<WeaponRequest> findByRequestedBy_UserId(Integer userId);

List<WeaponRequest> findByStatus(String status);
Comment on lines +14 to +16
WeaponRequestDto approvedRequest(Integer requestId);

WeaponRequestDto rejectedRequest(Integer requestId);
Comment on lines +89 to +97
@GetMapping("/issued/{officerId}")
public List<WeaponIssue> getActiveWeapons(@PathVariable Integer officerId) {
return weaponIssueRepository.findByIssuedTo_UserIdAndReturnedAtIsNullOrderByIssuedAtDesc(officerId);
}

@GetMapping("/history/{officerId}")
public List<WeaponIssue> getWeaponIssueHistory(@PathVariable Integer officerId) {
return weaponIssueRepository.findByIssuedTo_UserIdOrderByIssuedAtDesc(officerId);
}
Comment on lines +92 to +95
@GetMapping("/officer/{officerId}")
public List<Weapon> getWeaponsIssuedToOfficer(@PathVariable Integer officerId) {
return weaponService.getWeaponsIssuedToOfficer(officerId);
}
return ResponseEntity.ok(requests);
}

@GetMapping("user/{userId}")
@iSiRaH
iSiRaH merged commit be85294 into main Mar 14, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants